package common.io.console;

import java.io.Console;
import java.io.PrintWriter;
import java.io.Reader;

/**
 * Created by Gerardo on 2/10/14.
 */
public class ConsoleDevice implements Terminal {
	private final Console console;

	public ConsoleDevice(final Console console) {
		this.console = console;
	}

	@Override
	public Terminal printf(final String fmt, final Object... params) throws TerminalException {
		console.printf(fmt, params);
		return this;
	}

	@Override
	public String readLine() throws TerminalException {
		return console.readLine();
	}

	@Override
	public String readLine(final String fmt, final Object... params) throws TerminalException {
		return console.readLine(fmt, params);
	}

	@Override
	public char[] readPassword() throws TerminalException {
		return console.readPassword();
	}

	@Override
	public char[] readPassword(final String fmt, final Object... params) throws TerminalException {
		return console.readPassword(fmt, params);
	}

	@Override
	public Reader reader() throws TerminalException {
		return console.reader();
	}

	@Override
	public PrintWriter writer() throws TerminalException {
		return console.writer();
	}
}
